package com.seezoon.interfaces;

import com.seezoon.application.user.dto.GenerateCaptchaCmd;
import com.seezoon.application.user.dto.clientobject.GenerateCaptchaCO;
import com.seezoon.application.user.executor.GenerateCaptchaCmdExe;
import com.seezoon.infrastructure.dto.Response;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "公共接口", description = "无需登录态")
@RequiredArgsConstructor
@Slf4j
@RestController
@RequestMapping("/public")
public class PublicController {

    private final GenerateCaptchaCmdExe generateCaptchaCmdExe;

    @Operation(summary = "生成图形验证码")
    @PostMapping("/generate_captcha")
    public Response<GenerateCaptchaCO> generateCaptcha(@RequestBody GenerateCaptchaCmd cmd) {
        return generateCaptchaCmdExe.execute(cmd);
    }
}
